a,b = input(),input()

common_prefix = ''
for i in range(min(len(a), len(b))):
    if a[i] == b[i]:
        common_prefix += a[i]
    else:
        break

print('Common prefix:', common_prefix)